package com.blog.config;

import io.minio.MinioClient;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MinioConfig {

    @Value("${minio.host}")
    private String host;
    @Value("${minio.port}")
    private String port;
    //private String endpoint="http://192.168.1.128:9000";
    private String accessKey="0v0FfUry9qFS3lNq6gLl";
    private String secretKey="nLRlXHx5tWPMNkBAWaNZ0VMgtdrwfdPaLVwDHuLI";
    @Bean
    public MinioClient getMinioClient() {
        String endpoint="http://"+host+":"+port;
        System.out.println("endpoint="+endpoint);
        return MinioClient.builder()
                .endpoint(endpoint)
                .credentials(accessKey, secretKey).build();
    }
}
